package com.dynabook.ems.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.dynabook.ems.common.BaseResponse;
import com.dynabook.ems.common.ResultUtils;
import com.dynabook.ems.model.dto.ReturnMachineListDTO;
import com.dynabook.ems.model.vo.ReturnMachineListVO;
import com.dynabook.ems.service.EmsMyBorrowService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@Slf4j
@Api(tags = "样机操作", description = "样机操作相关接口")
public class SampleController {


    @Resource
    private EmsMyBorrowService emsMyBorrowService;
   @ApiOperation(value = "更新老数据")
   @PostMapping("/updateOldData")
   public BaseResponse<Boolean> updateOldData() {
      Boolean result = emsMyBorrowService.updateOldData();
      return ResultUtils.success(result);
    }

    @ApiOperation(value = "待归还列表")
    @PostMapping("/getReturnMachineList")
    public BaseResponse<Page<ReturnMachineListVO>> getReturnMachineList(@RequestBody ReturnMachineListDTO returnMachineListDTO) {
        Page<ReturnMachineListVO> page =   emsMyBorrowService.getMachineList(returnMachineListDTO);
        return ResultUtils.success(page);
    }
}
